package com.jinzhuo.music.service;

import com.jinzhuo.music.dao.SingerMapper;
import com.jinzhuo.music.domain.Singer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Singer实现类
 */
@Service
public class SingerServiceImpl implements SingerService {
    @Autowired
    private SingerMapper singerMapper;


    /**
     * 添加
     *
     * @param pojo
     */
    @Override
    public boolean addSinger(Singer pojo) {
       return singerMapper.addSinger(pojo)>0;
    }

    /**
     * 修改
     *
     * @param pojo
     */
    @Override
    public boolean updateSinger(Singer pojo) {
        return singerMapper.updateSinger(pojo)>0;
    }

    /**
     * 删除
     *
     * @param id
     */
    @Override
    public boolean deleteSinger(Integer id) {
        return singerMapper.deleteSinger(id)>0;
    }

    /**
     * 根据主键查询单个对象
     *
     * @param id
     */
    @Override
    public Singer getSinger(Integer id) {
        return singerMapper.getSinger(id);
    }

    /**
     * 查询所有对象
     */
    @Override
    public List<Singer> queryAllSinger() {
        return singerMapper.queryAllSinger();
    }

    /**
     * 根据名字查询歌手
     *
     * @param name
     */
    @Override
    public List<Singer> querySingerByName(String name) {
        return singerMapper.querySingerByName(name);
    }

    /**
     * 根据性别查询歌手
     *
     * @param sex
     */
    @Override
    public List<Singer> querySingerBySex(Integer sex) {
        return singerMapper.querySingerBySex(sex);
    }
}
